package com.gigmissions.client;


import com.extjs.gxt.ui.client.Style.LayoutRegion;  
import com.extjs.gxt.ui.client.Style.Scroll;
import com.extjs.gxt.ui.client.data.BeanModel;
import com.extjs.gxt.ui.client.data.ListLoadResult;
import com.extjs.gxt.ui.client.data.ListLoader;
import com.extjs.gxt.ui.client.event.ButtonEvent;  
import com.extjs.gxt.ui.client.event.SelectionListener;  
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.util.Margins;  
import com.extjs.gxt.ui.client.widget.ContentPanel;  
import com.extjs.gxt.ui.client.widget.Dialog;  
import com.extjs.gxt.ui.client.widget.LayoutContainer;  
import com.extjs.gxt.ui.client.widget.button.Button;  
import com.extjs.gxt.ui.client.widget.button.ButtonBar;  
import com.extjs.gxt.ui.client.widget.layout.BorderLayout;  
import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData;  
import com.extjs.gxt.ui.client.widget.layout.FlowData;  
import com.gigmissions.client.model.Venue;
import com.google.gwt.maps.client.MapWidget;
import com.google.gwt.user.client.Element; 

public class AddGigDialog extends LayoutContainer {
		private MapWidget map;
	
		public AddGigDialog(MapWidget map){
			
			this.map = map;
			
		}
	
	
	 @Override  
	   protected void onRender(Element parent, int pos) {  
		 
	     super.onRender(parent, pos);  
	    	   
	     final Dialog complex = new Dialog();  
	     complex.setBodyBorder(false);  
	     //complex.setIcon(Examples.ICONS.side_list());  
	     complex.setHeading("Add a gig to gig missions:");  
	     complex.setWidth(500);  
	     complex.setHeight(455);  
	     complex.setHideOnButtonClick(true);  
	   
	     BorderLayout layout = new BorderLayout();  
	     complex.setLayout(layout);  
	   
	     // get the venues
	     ListStore<BeanModel>  venueStore = VenueServiceUtil.getVenues(map);
	     
	     //get the photos
	     ListStore<BeanModel>  photoStore = VenueServiceUtil.getPhotos(map);
	   
 		 	     
	     ContentPanel panel = new VenueSelectPanel(photoStore);
	     panel.setScrollMode(Scroll.AUTOY);
	     panel.setHeading("Choose a venue");  
	     BorderLayoutData data = new BorderLayoutData(LayoutRegion.CENTER, 150, 100, 250);  
	     data.setMargins(new Margins(0, 5, 0, 0));  
	     data.setSplit(true);  
	     data.setCollapsible(true);  
	     data.setFloatable(true);  
	     complex.add(panel, data);  
	   
	     /*
	     panel = new GigDetailsPanel();
	     panel.setHeading("Centre");
	     data = new BorderLayoutData(LayoutRegion.CENTER);  
	     complex.add(panel, data);  
	      */
	     ButtonBar buttons = new ButtonBar();  
	   
	     buttons.add(new Button("Add Gig...", new SelectionListener<ButtonEvent>() {  
	       public void componentSelected(ButtonEvent ce) {  
	         complex.show();  
	       }  
	     }));  
	   
	     add(buttons, new FlowData(10));  
	   }  

}
